﻿<%@ Page Language="C#" MasterPageFile="~/quickLMS.master" AutoEventWireup="true" CodeFile="ManageCourses.aspx.cs" Inherits="Admin_ManageCourses" Title="Manage Courses" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:UpdatePanel ID="update1" runat="server">
    <ContentTemplate>
Course Name:
<br />
<asp:TextBox ID="txtName" runat="server" Width="400"></asp:TextBox>
<br />
<br />

<asp:Button id="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
<br />
<br />
<asp:Panel ID="pnlResults" runat="server" Visible="false">
<asp:GridView id="grdCourses" runat="server" SkinID="subsonicSkin" AutoGenerateColumns="false" AllowPaging="true" PageSize="10" OnPageIndexChanging="ChangePage">
<Columns>
    <asp:BoundField DataField="CourseName" HeaderText="Name" ItemStyle-Wrap="false" ItemStyle-Width="20%" />
    <asp:HyperLinkField DataNavigateUrlFields="CourseID" Text="Edit" HeaderText="Edit" DataNavigateUrlFormatString="~/Admin/EditCourse.aspx?CourseID={0}" />
    <asp:TemplateField HeaderText="Delete">
        <ItemTemplate>
            <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" OnCommand="DeleteCourse" CommandArgument='<%# Eval("CourseID") %>' OnClientClick="return confirm('Are you sure you want to delete this course?')"></asp:LinkButton>
        </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Launch">
        <ItemTemplate>
            <asp:HyperLink ID="lnkWebLaunch" runat="server" Text="Launch" OnPreRender="SetVisibilityW"></asp:HyperLink>
            <asp:HiddenField ID="hidID1" runat="server" Value='<%# Eval("CourseID") %>' />
        </ItemTemplate>
    </asp:TemplateField>
    <asp:HyperLinkField DataNavigateUrlFields="CourseID" Text="Edit Cartridge" HeaderText="Edit Cartridge" DataNavigateUrlFormatString="~/Admin/AuthTool/AuthTool.aspx?CourseID={0}" />
</Columns>
<EmptyDataTemplate>
No courses match search criteria...
</EmptyDataTemplate>
</asp:GridView>    
    </asp:Panel>
    
    <br />
    <br />
    <asp:HyperLink ID="hypNewCourse" runat="server" NavigateUrl="~/admin/EditCourse.aspx?CourseID=-1">Add New Course</asp:HyperLink>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="updateProgress" runat="server">
<ProgressTemplate>
    Processing...
</ProgressTemplate></asp:UpdateProgress>
</asp:Content>

